﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using LyData.Data;

public partial class Controls_left : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            Bind();
        }
    }

    //
    private void Bind()
    {
        IDb db = new DbFactory().DriverDb();
        db.Open();
        DataTable table = db.DataTable("top 5 Title,ArticleId", "article", "ArtTJ=true and MenuId=12", "weight Asc,ArticleId desc");
        DataRow row = db.TopRow("SinglePageId,PageContent", "singlePage", "SinglePageId=3", "SinglePageId desc");
        db.Close();

        rptnotice.DataSource = table;
        rptnotice.DataBind();

        if(row!=null)
        {
            litcontact.Text = row["PageContent"].ToString();
        }
    }
}
